<template>
  <div id="hk-article">
    <!-- 头部栏 -->
    <div class="Header_bar">
      <van-search
        label="上海"
        show-action
        v-model="value"
        placeholder="请输入小区或地址"
      >
        <template #action>
          <div>
            <van-icon size="25" color="#fff" />
            <span class="icon-ditu iconfont"></span>
          </div>
          <!-- name="aim" -->
        </template>
      </van-search>
    </div>
    <!-- 轮播图 -->
    <div class="Swipe">
      <van-swipe :autoplay="3000" class="my-swipe" indicator-color="white">
        <van-swipe-item v-for="item in lbimgs" :key="item.id">
          <img
            v-lazy="'http://liufusong.top:8080' + item.imgSrc"
            height="212"
          />
        </van-swipe-item>
      </van-swipe>
    </div>
    <!-- 宫格 -->
    <div class="gongge">
      <van-grid :border="false">
        <van-grid-item>
          <van-icon
            class="iconfont article-iconfont"
            class-prefix="icon-pinzhizhengzu"
          ></van-icon>
          <p>整租</p>
        </van-grid-item>
        <van-grid-item>
          <van-icon
            class="iconfont article-iconfont"
            class-prefix="icon-hezu"
          ></van-icon>
          <p>合租</p>
        </van-grid-item>
        <van-grid-item>
          <van-icon
            class="iconfont article-iconfont"
            class-prefix="icon-dituzhaofang"
          ></van-icon>
          <p>地图找房</p>
        </van-grid-item>
        <van-grid-item>
          <van-icon
            class="iconfont article-iconfont"
            class-prefix="icon-woyaochuzu"
          ></van-icon>
          <p>去出租</p>
        </van-grid-item>
      </van-grid>
    </div>
    <!-- 租房小组 -->
    <div class="zhufangxz">
      <div class="biao">
        <h3>租房小组</h3>
        <p>更多</p>
      </div>
      <div class="meirong">
        <van-grid
          :border="false"
          :column-num="2"
          direction="horizontal"
          gutter="10"
        >
          <van-grid-item v-for="item in zfdata" :key="item.id">
            <div class="zf-img">
              <img v-lazy="'http://liufusong.top:8080' + item.imgSrc" />
            </div>
            <div class="tex">
              <h4>{{ item.title }}</h4>
              <p>{{ item.desc }}</p>
            </div>
          </van-grid-item>
        </van-grid>
      </div>
    </div>
  </div>
</template>

<script>
import request from '@/utils/request'
export default {
  name: 'hk-article',
  data() {
    return {
      value: '',
      lbimgs: [],
      zfdata: []
    }
  },
  async created() {
    const res = await request({
      url: '/home/swiper',
      method: 'get'
    })
    console.log(res)
    this.lbimgs = res.body
    const zfres = await request({
      url: '/home/groups',
      method: 'get'
    })
    console.log(zfres)
    this.zfdata = zfres.body
  },
  methods: {}
}
</script>
<style scoped lang="less">
.icon-ditu {
  font-size: 32px;
  color: #fff;
  line-height: 20px;
}
.article-iconfont {
  color: #10b36f;
  background-color: #f2fbf7;
  border-radius: 50%;
  font-size: 45px;
  // padding-bottom: 10px;
  padding: 6px;
  margin-bottom: 5px;
}

.my-swipe .van-swipe-item {
  color: #fff;
  font-size: 20px;
  // line-height: 212px;
  text-align: center;
  background-color: #39a9ed;
}
#hk-article {
  position: relative;
  .Header_bar {
    position: absolute;
    z-index: 99999;
    top: 15px;
    left: 0;
    width: 100%;
    .van-search {
      background-color: rgba(255, 255, 255, 0);
      padding: 5px 20px 5px 20px;
    }
  }
}
.van-field__control {
  height: 34px;
}
.van-search__action {
  line-height: 0;
  padding: 5px;
  padding-right: 0;
}
.gongge {
  height: 122px;
  background-color: #fff;
}
/deep/ .van-grid-item__content {
  padding-top: 20px;
  padding-bottom: 20px;
}
.zhufangxz {
  background-color: #f6f5f6;
  width: 100%;
  padding-bottom: 10px;
  .biao {
    display: flex;
    justify-content: space-between;
    background-color: rgba(255, 255, 255, 0);
    width: 100%;
    padding: 10px;
    h3 {
      font-size: 16px;
    }
    p {
      font-size: 12px;
      color: #999;
    }
  }
  .meirong {
    .zf-img {
      width: 50px;
      height: 50px;
      img {
        width: 100%;
        height: 100%;
      }
    }
    .tex {
      width: 70px;
      height: 50px;
      font-size: 14px;
      line-height: 25px;
      margin: 0 10px 0 10px;
    }
  }
}
</style>
